{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "#给好友发送单条消息\n",
    "from pywechat.WechatAuto import Messages\n",
    "Messages.send_message_to_friend(friend='文件传输助手',message='你好',delay=0.2,tickle=False,search_pages=0)\n",
    "#或者\n",
    "# import pywechat.WechatAuto as wechat\n",
    "# wechat.send_message_to_friend(friend='文件传输助手',message='你好',delay=0.2,tickle=False,search_pages=0)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "#给单个好友发送多条消息\n",
    "from pywechat.WechatAuto import Messages\n",
    "Messages.send_messages_to_friend(friend='文件传输助手',messages=['你好','干嘛呢？'],delay=0.2,tickle=False,search_pages=0)\n",
    "#或者\n",
    "# import pywechat.WechatAuto as wechat\n",
    "# wechat.send_messages_to_friend(friend='文件传输助手',messages=['你好','干嘛呢？'],delay=0.2,tickle=False,search_pages=0)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "#给多个好友分别发送单条信息\n",
    "from pywechat.WechatAuto import Messages\n",
    "Messages.send_message_to_friends(friends=['文件传输助手','测试ing'],message=['给文件传输助手发消息','给测试ing发消息'],tickle=[False,True],delay=0.2)\n",
    "#或者\n",
    "# import pywechat.WechatAuto as wechat\n",
    "# wechat.send_message_to_friends(friends=['文件传输助手','测试ing'],message=['给文件传输助手发消息','给测试ing发消息'],tickle=[False,True],delay=0.2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "#给多个好友分别发送多条信息\n",
    "from pywechat.WechatAuto import Messages\n",
    "Messages.send_messages_to_friends(friends=['文件传输助手','测试ing'],messages=[['你好','干嘛呢?'],['你好','干嘛呢?']],delay=0.2)\n",
    "#或者\n",
    "# import pywechat.WechatAuto as wechat\n",
    "# wechat.send_messages_to_friends(friends=['文件传输助手','测试ing'],messages=[['你好','干嘛呢?'],['你好','干嘛呢?']],delay=0.2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "#转发消息\n",
    "from pywechat.WechatAuto import Messages\n",
    "Messages.forward_message(friends=['文件传输助手','测试ing'],message='通知:测试转发消息，望周知，收到请回复',search_pages=0)\n",
    "#或者\n",
    "# import pywechat.WechatAuto as wechat\n",
    "# wechat.forward_message(friends=['文件传输助手','测试ing'],message='通知:测试转发消息，望周知，收到请回复',search_pages=0)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "#监听新消息(返回数据格式为list[{},{}]的json)\n",
    "from pywechat.WechatAuto import check_new_message\n",
    "print(check_new_message(duration='1min'))\n",
    "#或者\n",
    "# import pywechat.WechatAuto as wechat\n",
    "# print(wechat.check_new_message(duration='1min'))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "#给单个好友发送单个文件\n",
    "from pywechat.WechatAuto import Files\n",
    "Files.send_file_to_friend(friend='文件传输助手',file_path=\"E:\\OneDrive\\Desktop\\文件发送测试.jpg\",delay=0.2)\n",
    "#或者\n",
    "# import pywechat.WechatAuto as wechat\n",
    "# wechat.send_file_to_friend(friend='文件传输助手',file_path=\"E:\\OneDrive\\Desktop\\文件发送测试.jpg\",delay=0.2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "#给单个好友发送多个文件(文件夹内第一级所有文件)\n",
    "from pywechat.WechatAuto import Files\n",
    "Files.send_files_to_friend(friend='文件传输助手',folder_path=r\"E:\\OneDrive\\Desktop\\文件发送测试\",delay=0.2)\n",
    "#或者\n",
    "# import pywechat.WechatAuto as wechat\n",
    "# wechat.send_files_to_friend(friend='文件传输助手',folder_path=r\"E:\\OneDrive\\Desktop\\文件发送测试\",delay=0.2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "#给多个好友分别发送单个不同文件\n",
    "from pywechat.WechatAuto import Files\n",
    "Files.send_file_to_friends(friends=['文件传输助手','测试ing'],file_paths=[r\"E:\\OneDrive\\Desktop\\文件发送测试1.jpg\",r\"E:\\OneDrive\\Desktop\\文件发送测试2.jpg\"])\n",
    "#或者\n",
    "# import pywechat.WechatAuto as wechat\n",
    "# wechat.send_file_to_friends(friends=['文件传输助手','测试ing'],file_paths=[\"rE:\\OneDrive\\Desktop\\文件发送测试1.jpg\",r\"E:\\OneDrive\\Desktop\\文件发送测试2.jpg\"])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "#给多个好友发送多个文件(每个好友对应一个文件夹)\n",
    "from pywechat.WechatAuto import Files\n",
    "Files.send_files_to_friends(friends=['文件传输助手','测试ing'],folder_paths=[r\"E:\\OneDrive\\Desktop\\文件发送测试1\",r\"E:\\OneDrive\\Desktop\\文件发送测试2\"])\n",
    "#或者\n",
    "# import pywechat.WechatAuto as wechat\n",
    "# wechat.send_files_to_friends(friends=['文件传输助手','测试ing'],folder_paths=[r\"E:\\OneDrive\\Desktop\\文件发送测试1\",r\"E:\\OneDrive\\Desktop\\文件发送测试2\"])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "#转发文件\n",
    "from pywechat.WechatAuto import Files\n",
    "Files.forward_file(friends=['文件传输助手','测试ing'],file_path=r\"E:\\OneDrive\\Desktop\\文件发送测试.jpg\")\n",
    "#或者\n",
    "# import pywechat.WechatAuto as wechat\n",
    "# wechat.forward_file(friends=['文件传输助手','测试ing'],file_path=r\"E:\\OneDrive\\Desktop\\文件发送测试.jpg\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "\n",
    "#获取所有好友的备注与名称\n",
    "from pywechat.WechatAuto import Contacts\n",
    "print(Contacts.get_friends_names())\n",
    "#或者\n",
    "# import pywechat.WechatAuto as wechat\n",
    "# print(wechat.get_friends_names())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "#获取所有好友昵称备注与微信号\n",
    "from pywechat.WechatAuto import Contacts\n",
    "print(Contacts.get_friends_info())\n",
    "#或者\n",
    "# import pywechat.WechatAuto as wechat\n",
    "# print(wechat.get_friends_info())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "#获取所有好友详细信息\n",
    "from pywechat.WechatAuto import Contacts\n",
    "print(Contacts.get_friends_detail())\n",
    "#或者\n",
    "# import pywechat.WechatAuto as wechat\n",
    "# print(wechat.get_friends_detail())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "#获取所有群聊信息\n",
    "from pywechat.WechatAuto import Contacts\n",
    "print(Contacts.get_groups_info())\n",
    "#或者\n",
    "# import pywechat.WechatAuto as wechat\n",
    "# print(wechat.get_groups_info())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "#获取群内所有群成员群昵称\n",
    "from pywechat.WechatAuto import Contacts\n",
    "print(Contacts.get_groupmembers_info(group_name='一家人'))\n",
    "#或者\n",
    "# import pywechat.WechatAuto as wechat\n",
    "# print(wechat.get_groupmembers_info(group_name='一家人'))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "#获取所有企业微信好友信息\n",
    "from pywechat.WechatAuto import Contacts\n",
    "print(Contacts.get_wecom_friends_info())\n",
    "#或者\n",
    "# import pywechat.WechatAuto as wechat\n",
    "# print(wechat.get_wecom_friends_info())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "#获取好友聊天记录 \n",
    "from pywechat.WechatAuto import FriendSettings\n",
    "FriendSettings.get_chat_history(friend='文件传输助手',number=100,capture_screen=True,folder_path=\"E:\\OneDrive\\Desktop\\保存聊天记录\")\n",
    "#或者\n",
    "# import pywechat.WechatAuto as wechat \n",
    "# wechat.get_chat_history(friend='文件传输助手',number=100,capture_screen=True,folder_path=\"E:\\OneDrive\\Desktop\\保存聊天记录\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "#添加好友至黑名单\n",
    "from pywechat.WechatAuto import FriendSettings\n",
    "FriendSettings.add_friend_to_blacklist(friend='测试ing')\n",
    "#或者\n",
    "# import pywechat.WechatAuto as wechat\n",
    "# wechat.add_friend_to_blacklist(friend='测试ing') "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "#添加新朋友(注意,不要过于频繁使用该函数,否则加好友功能会被限制)\n",
    "from pywechat.WechatAuto import FriendSettings\n",
    "FriendSettings.add_new_friend(phone_number='12125262220',request_content='你好,我是....')\n",
    "#或者\n",
    "# import pywechat.WechatAuto as wechat\n",
    "# wechat.add_new_friend(phone_number='12125262220',request_content='你好，我是....')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "#好友会话内置顶\n",
    "from pywechat.WechatAuto import FriendSettings\n",
    "FriendSettings.pin_friend(friend='测试ing')\n",
    "#或者\n",
    "# import pywechat.WechatAuto as wechat\n",
    "# wechat.pin_friend(friend='测试ing') "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "#好友置顶\n",
    "from pywechat.WechatAuto import FriendSettings\n",
    "FriendSettings.sticky_friend_on_top(friend='测试ing')\n",
    "#或者\n",
    "# import pywechat.WechatAuto as wechat\n",
    "# wechat.sticky_friend_on_top(friend='测试ing')  "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "#将好友设置为星标朋友\n",
    "from pywechat.WechatAuto import FriendSettings\n",
    "FriendSettings.set_friend_as_star_friend(friend='测试ing',state='close')\n",
    "#或者\n",
    "# import pywechat.WechatAuto as wechat\n",
    "# wechat.set_friend_as_star_friend(friend='测试ing') "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "#删除好友\n",
    "from pywechat.WechatAuto import FriendSettings\n",
    "FriendSettings.delete_friend(friend='测试ing')\n",
    "#或者\n",
    "# import pywechat.WechatAuto as wechat\n",
    "# wechat.delete_friend(friend='测试ing')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "#清空好友聊天记录 \n",
    "from pywechat.WechatAuto import FriendSettings\n",
    "FriendSettings.clear_friend_chat_history(friend='测试ing')\n",
    "#或者\n",
    "# import pywechat.WechatAuto as wechat\n",
    "# wechat.clear_friend_chat_history(friend='测试ing')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "#好友消息免打扰\n",
    "from pywechat.WechatAuto import FriendSettings\n",
    "FriendSettings.mute_friend_notifications(friend='测试ing')\n",
    "#或者\n",
    "# import pywechat.WechatAuto as wechat\n",
    "# wechat.mute_friend_notifications(friend='测试ing')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "#拍一拍好友\n",
    "from pywechat.WechatAuto import FriendSettings\n",
    "FriendSettings.tickle_friend(friend='测试ing')\n",
    "#或者\n",
    "# from pywechat.WechatAuto import FriendSettings\n",
    "# FriendSettings.tickle_friend(friend='测试ing')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "#推荐好友给朋友\n",
    "from pywechat.WechatAuto import FriendSettings\n",
    "FriendSettings.share_contact(friend='测试ing',others=['文件传输助手','路人甲','路人乙'])\n",
    "#或者\n",
    "# import pywechat.WechatAuto as wechat\n",
    "# wechat.share_contact(friend='测试ing',others=['文件传输助手','路人甲','路人乙']) "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "#修改好友备注和标签\n",
    "from pywechat.WechatAuto import FriendSettings\n",
    "FriendSettings.change_friend_remark_and_tag(friend='测试ing',remark='起个破名想半天了')\n",
    "#或者\n",
    "# import pywechat.WechatAuto as wechat\n",
    "# wechat.change_friend_remark_and_tag(friend='测试ing',remark='起个破名想半天了')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "#获取单个好友微信号\n",
    "from pywechat.WechatAuto import FriendSettings\n",
    "print(FriendSettings.get_friend_wechat_number(friend='测试ing'))\n",
    "#或者\n",
    "# import pywechat.WechatAuto as wechat\n",
    "# print(wechat.get_friend_wechat_number(friend='测试ing'))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "#获取多个好友微信号\n",
    "from pywechat.WechatAuto import FriendSettings\n",
    "print(FriendSettings.get_friends_wechat_numbers(friends=['路人甲','路人乙']))\n",
    "#或者\n",
    "# import pywechat.WechatAuto as wechat\n",
    "# print(wechat.get_friends_wechat_numbers(friends=['路人甲','路人乙']))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "#修改好友权限\n",
    "from pywechat.WechatAuto import FriendSettings\n",
    "FriendSettings.change_friend_privacy(friend='测试ing',privacy='聊天、朋友圈、微信运动等')\n",
    "#或者\n",
    "# import pywechat.WechatAuto as wechat\n",
    "# wechat.change_friend_privacy(friend='测试ing',privacy='仅聊天')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "#自动回复指定好友消息\n",
    "from pywechat.WechatAuto import AutoReply\n",
    "chat_history=AutoReply.auto_reply_to_friend(friend='测试ing',duration='5min',content='你好我不在请稍后联系',save_chat_history=True,capture_screen=True,folder_path=\"E:\\OneDrive\\Desktop\\测试专用\")\n",
    "print(chat_history)\n",
    "#或者\n",
    "#import pywechat.WechatAuto as wechat\n",
    "#chat_history=wechat.auto_reply_to_friend(friend='测试ing',duration='5min',content='你好我不在请稍后联系',save_chat_history=True,capture_screen=True,folder_path=\"E:\\OneDrive\\Desktop\\测试专用\")\n",
    "#print(chat_history)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "#自动回复消息\n",
    "from pywechat.WechatAuto import AutoReply\n",
    "AutoReply.auto_reply_messages(duration='5min',content='你好我不在请稍后联系')\t\n",
    "#或者\n",
    "#import pywechat.WechatAuto as wechat\n",
    "#wechat.auto_reply_to_friend(duration='5min',content='你好我不在请稍后联系')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "#自动接听电话\n",
    "from pywechat.WechatAuto import AutoReply\n",
    "AutoReply.auto_answer_call(duration='5min',broadcast_content='你好我不在,请稍后联系',message='你好我不在，请稍后联系',times=1)\n",
    "#或者\n",
    "# import pywechat.WechatAuto as wechat\n",
    "# wechat.auto_answer_call(duration='5min',broadcast_content='你好我不在,请稍后联系',message='你好我不在请稍后联系',times=3)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.12.0"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
